import axios from 'axios'
import { message } from 'ant-design-vue'

export class StartupUtils {
    public static init () {
        axios.interceptors.response.use(
            response => {
                if (response.config.url === '/api/isRegisted') {
                    return response
                } else {
                    return response.data
                }
            }, error => {
                message.error('接口异常信息：' + error.message)
                return Promise.reject(error.response.data)
            }
        )
        StartupUtils.antdConfig()
    }

    private static antdConfig () {
        message.config({
            duration: 5
        })
    }
}
